/*
 * @CopyRight: Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 * @Description: kml interface for numpy funtions
 * @Aythor: LiuYongYang
 * @Date: 2023-02-20 17:45:45
 */

#ifndef HVML_ADAPTER_H
#define HVML_ADAPTER_H

#include <math.h>
#include "Python.h"
#include "hygonvml.h"

//  ---------------------------------------------------------------------------------
//  --------------------------------------FLOAT--------------------------------------
//  ---------------------------------------------------------------------------------

inline void HML_VML_FLOAT_add(char **args, Py_intptr_t const *dimensions)
{
    vsAdd(dimensions[0], (float*)args[0], (float*)args[1], (float*)args[0x2]);
}

inline void HML_VML_FLOAT_subtract(char **args, Py_intptr_t const *dimensions)
{
    vsSub(dimensions[0], (float*)args[0], (float*)args[1], (float*)args[0x2]);
}

inline void HML_VML_FLOAT_multiply(char **args, Py_intptr_t const *dimensions)
{
    vsMul(dimensions[0], (float*)args[0], (float*)args[1], (float*)args[0x2]);
}

inline void HML_VML_FLOAT_divide(char **args, Py_intptr_t const *dimensions)
{
    vsDiv(dimensions[0], (float*)args[0], (float*)args[1], (float*)args[0x2]);
}

inline void HML_VML_FLOAT_exp(char **args, Py_intptr_t const *dimensions)
{
    vsExp(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_sqrt(char **args, Py_intptr_t const *dimensions)
{
    vsSqrt(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_log(char **args, Py_intptr_t const *dimensions)
{
    vsLn(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_sin(char **args, Py_intptr_t const *dimensions)
{
    vsSin(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_cos(char **args, Py_intptr_t const *dimensions)
{
    vsCos(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_tan(char **args, Py_intptr_t const *dimensions)
{
    vsTan(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_arctan(char **args, Py_intptr_t const *dimensions)
{
    vsAtan(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_power(char **args, Py_intptr_t const *dimensions)
{
    vsPow(dimensions[0], (float*)args[0], (float*)args[1], (float*)args[0x2]);
}

inline void HML_VML_FLOAT_fmod(char **args, Py_intptr_t const *dimensions)
{
    vsFmod(dimensions[0], (float*)args[0], (float*)args[1], (float*)args[0x2]);
}

inline void HML_VML_FLOAT_ceil(char **args, Py_intptr_t const *dimensions)
{
    vsCeil(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_absolute(char **args, Py_intptr_t const *dimensions)
{
    vsAbs(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_tanh(char **args, Py_intptr_t const *dimensions)
{
    vsTanh(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_exp2(char **args, Py_intptr_t const *dimensions)
{
    vsExp2(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_log2(char **args, Py_intptr_t const *dimensions)
{
    vsLog2(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_log10(char **args, Py_intptr_t const *dimensions)
{
    vsLog10(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_expm1(char **args, Py_intptr_t const *dimensions)
{
    vsExpm1(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_log1p(char **args, Py_intptr_t const *dimensions)
{
    vsLog1p(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_cbrt(char **args, Py_intptr_t const *dimensions)
{
    vsCbrt(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_sinh(char **args, Py_intptr_t const *dimensions)
{
    vsSinh(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_arcsin(char **args, Py_intptr_t const *dimensions)
{
    vsAsin(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_arccos(char **args, Py_intptr_t const *dimensions)
{
    vsAcos(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_cosh(char **args, Py_intptr_t const *dimensions)
{
    vsCosh(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_arcsinh(char **args, Py_intptr_t const *dimensions)
{
    vsAsinh(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_arccosh(char **args, Py_intptr_t const *dimensions)
{
    vsAcosh(dimensions[0], (float*)args[0], (float*)args[1]);
}

inline void HML_VML_FLOAT_arctanh(char **args, Py_intptr_t const *dimensions)
{
    vsAtanh(dimensions[0], (float*)args[0], (float*)args[1]);
}
//  ----------------------------------------------------------------------------------
//  --------------------------------------DOUBLE--------------------------------------
//  ----------------------------------------------------------------------------------

inline void HML_VML_DOUBLE_add(char **args, Py_intptr_t const *dimensions)
{
    vdAdd(dimensions[0], (double*)args[0], (double*)args[1], (double*)args[0x2]);
}

inline void HML_VML_DOUBLE_subtract(char **args, Py_intptr_t const *dimensions)
{
    vdSub(dimensions[0], (double*)args[0], (double*)args[1], (double*)args[0x2]);
}

inline void HML_VML_DOUBLE_multiply(char **args, Py_intptr_t const *dimensions)
{
    vdMul(dimensions[0], (double*)args[0], (double*)args[1], (double*)args[0x2]);
}

inline void HML_VML_DOUBLE_divide(char **args, Py_intptr_t const *dimensions)
{
    vdDiv(dimensions[0], (double*)args[0], (double*)args[1], (double*)args[0x2]);
}

inline void HML_VML_DOUBLE_exp(char **args, Py_intptr_t const *dimensions)
{
    vdExp(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_sqrt(char **args, Py_intptr_t const *dimensions)
{
    vdSqrt(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_log(char **args, Py_intptr_t const *dimensions)
{
    vdLn(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_sin(char **args, Py_intptr_t const *dimensions)
{
    vdSin(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_cos(char **args, Py_intptr_t const *dimensions)
{
    vdCos(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_tan(char **args, Py_intptr_t const *dimensions)
{
    vdTan(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_arctan(char **args, Py_intptr_t const *dimensions)
{
    vdAtan(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_power(char **args, Py_intptr_t const *dimensions)
{
    vdPow(dimensions[0], (double*)args[0], (double*)args[1], (double*)args[0x2]);
}

inline void HML_VML_DOUBLE_fmod(char **args, Py_intptr_t const *dimensions)
{
    vdFmod(dimensions[0], (double*)args[0], (double*)args[1], (double*)args[0x2]);
}

inline void HML_VML_DOUBLE_ceil(char **args, Py_intptr_t const *dimensions)
{
    vdCeil(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_absolute(char **args, Py_intptr_t const *dimensions)
{
    vdAbs(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_tanh(char **args, Py_intptr_t const *dimensions)
{
    vdTanh(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_exp2(char **args, Py_intptr_t const *dimensions)
{
    vdExp2(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_log2(char **args, Py_intptr_t const *dimensions)
{
    vdLog2(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_log10(char **args, Py_intptr_t const *dimensions)
{
    vdLog10(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_expm1(char **args, Py_intptr_t const *dimensions)
{
    vdExpm1(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_log1p(char **args, Py_intptr_t const *dimensions)
{
    vdLog1p(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_cbrt(char **args, Py_intptr_t const *dimensions)
{
    vdCbrt(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_sinh(char **args, Py_intptr_t const *dimensions)
{
    vdSinh(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_arcsin(char **args, Py_intptr_t const *dimensions)
{
    vdAsin(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_arccos(char **args, Py_intptr_t const *dimensions)
{
    vdAcos(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_cosh(char **args, Py_intptr_t const *dimensions)
{
    vdCosh(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_arcsinh(char **args, Py_intptr_t const *dimensions)
{
    vdAsinh(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_arccosh(char **args, Py_intptr_t const *dimensions)
{
    vdAcosh(dimensions[0], (double*)args[0], (double*)args[1]);
}

inline void HML_VML_DOUBLE_arctanh(char **args, Py_intptr_t const *dimensions)
{
    vdAtanh(dimensions[0], (double*)args[0], (double*)args[1]);
}
#endif
